package com.zy.cat.entity.resp;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class RSPE<T> implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value="状态码(1.成功 0.失败)",example="1")
	private int code;
	
	@ApiModelProperty(value="请求描述",example="request success")
	private String message;
	
	@JsonInclude(value=Include.NON_NULL)
	@ApiModelProperty(value="返回数据",example="[{}]")
	private T data;
	
	public RSPE(T t) {
		super();
		this.code = t==null?0:1;
		this.message = t==null?"empty":"success";
		this.data = t;
	}
	public RSPE(int code, String msg) {
		super();
		this.code = code;
		this.message = msg;
	}
	public RSPE(String msg,T t) {
		super();
		this.code = t==null?0:1;
		this.message = msg;
		this.data = t;
	}
	public RSPE(int code, String msg, T t) {
		super();
		this.code = code;
		this.message = msg;
		this.data = t;
	}
}
